//
//  NovelLongHorizontalTableViewCell.m
//  WuLi
//
//  Created by Gollum on 16/9/23.
//  Copyright © 2016年 Gollum. All rights reserved.
//

#import "NovelLongHorizontalTableViewCell.h"
#import "NovelLongHorizontalCollectionViewCell.h"

#define kNovelLongHorizontalCollectionViewCellReuse @"NovelLongHorizontalCollectionViewCellReuse"
@interface NovelLongHorizontalTableViewCell()<UICollectionViewDataSource,UICollectionViewDelegate>


@end

@implementation NovelLongHorizontalTableViewCell

- (void)awakeFromNib {
    //布局
    UICollectionViewFlowLayout * flowLayout = [[UICollectionViewFlowLayout alloc] init];
    flowLayout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
    flowLayout.minimumInteritemSpacing = 0;
    flowLayout.minimumLineSpacing = 0;
 flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    [self.collectionView setCollectionViewLayout:flowLayout];
    //注册（xib）
    
    
    UINib *nib = [UINib nibWithNibName:@"NovelLongHorizontalCollectionViewCell" bundle:[NSBundle mainBundle]];
    _collectionView.bounces = NO;
    _collectionView.scrollEnabled = YES;
    _collectionView.userInteractionEnabled = YES;
    _collectionView.delegate = self;
    _collectionView.dataSource = self;
//     _collectionView.backgroundColor = [UIColor colorWithRed:arc4random_uniform(255)/256.0 green:arc4random_uniform(255)/256.0 blue:arc4random_uniform(255)/256.0 alpha:1];
    [self.collectionView registerNib:nib forCellWithReuseIdentifier:kNovelLongHorizontalCollectionViewCellReuse];

}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 10;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    NovelLongHorizontalCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kNovelLongHorizontalCollectionViewCellReuse forIndexPath:indexPath];

    return cell;
    
}



- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
     return CGSizeMake([UIScreen mainScreen].bounds.size.width / 2.5, [UIScreen mainScreen].bounds.size.width / 2.5 * 0.8);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    
}

@end
